﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserList.aspx.cs" Inherits="Admin_User_UserList" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>查询用户</title>

    <link href="../../css/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../css/admin.css" rel="stylesheet" />
    <script src="../../js/jquery-1.7.2.min.js"></script>
    <script src="../../css/assets/js/bootstrap.min.js"></script>
    <script src="../../Js/layer/layer.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div class="row">
                <div runat="server" id="divCondition">
                    <div class="col-lg-4 col-md-4 col-sm-6 colSpace">
                        用户昵称：
                    <br />
                        <asp:TextBox runat="server" ID="txtNickName" CssClass="txtSize"></asp:TextBox>
                    </div>

                    <div class="col-lg-4 col-md-4 col-sm-6 colSpace">
                        用户手机：       
                    <br />
                        <asp:TextBox runat="server" ID="txtMobilePhone" CssClass="txtSize"></asp:TextBox>

                    </div>

                    <div class="col-lg-4 col-md-4 col-sm-6 colSpace">
                        用户类型：       
                    <br />
                        <asp:DropDownList runat="server" ID="ddlType" CssClass="txtSize">
                            <%--<asp:ListItem Text="全部" Value="0"></asp:ListItem>--%>
                            <asp:ListItem Text="注册用户" Value="1"></asp:ListItem>
                            <asp:ListItem Text="区域代理" Value="2"></asp:ListItem>
                            <asp:ListItem Text="运营人员" Value="3"></asp:ListItem>

                        </asp:DropDownList>
                    </div>


                    <%--    <div class="col-lg-4 col-md-4 col-sm-6 colSpace">
                        状态：       
                    <br />
                        <asp:DropDownList runat="server" ID="ddlStatus" CssClass="txtSize">
                            <asp:ListItem Text="全部" Value="0"></asp:ListItem>
                            <asp:ListItem Text="正常" Value="1"></asp:ListItem>
                            <asp:ListItem Text="未激活" Value="-1"></asp:ListItem>
                            <asp:ListItem Text="禁用" Value="-2"></asp:ListItem>
                        </asp:DropDownList>
                    </div> --%>

                    <div class="col-lg-4 col-md-4 col-sm-6 colSpace" style="margin-top: -2px">
                        <br />
                        <asp:Button runat="server" ID="btnSelect" Text="查询" CssClass="btn btn-primary btnSize" OnClick="btnSelect_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
             <asp:Label runat="server" CssClass="txtWarn" ID="lblWarn"></asp:Label>
                    </div>
                </div>
            </div>
            <br />
            <div>
                <asp:GridView runat="server" ID="gridList" CssClass="table table-striped table-bordered table-hover" AutoGenerateColumns="False" DataKeyNames="UserID" OnRowDeleting="gridList_RowDeleting" OnRowEditing="gridList_RowEditing" OnRowCancelingEdit="gridList_RowCancelingEdit" OnRowUpdating="gridList_RowUpdating">
                    <Columns>

                        <%-- <asp:BoundField DataField="HeadPortrait" HeaderText="头像" />--%>
                        <asp:TemplateField HeaderText="序号" HeaderStyle-Width="3%">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblTid" Text='<%# Bind("TID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="手机">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblMobilePhone" Text='<%# Bind("MobilePhone") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <%-- <asp:BoundField DataField="MobilePhone" HeaderText="手机" />--%>
                        <%--  <asp:BoundField DataField="NickName" HeaderText="昵称" />--%>
                        <%-- <asp:BoundField DataField="UserNum" HeaderText="编号" />--%>
                        <%-- <asp:BoundField DataField="WeiXinName" HeaderText="微信" HeaderStyle-Width="10%"/>--%>
                        <asp:TemplateField HeaderText="微信" HeaderStyle-Width="10%">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblWeiXinName" Text='<%# Bind("WeiXinName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="备注" HeaderStyle-Width="7%">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtRealName" runat="server" Text='<%# Bind("RealName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblRealName" Text='<%# Bind("RealName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:CommandField ShowEditButton="True" HeaderText="修改备注" EditText="修改备注" CancelText="取消" UpdateText="更新" />

                        <asp:TemplateField HeaderText="类型">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblTypeName" Text='<%# Bind("UserTypeName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="邀请人" HeaderStyle-Width="10%">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblReferrerName" Text='<%# Bind("ReferrerName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="注册时间">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblCreateTime" Text='<%# Bind("CreateTime") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="登录次数">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblLoginCount" Text='<%# Bind("LoginCount") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <%-- <asp:BoundField DataField="UserTypeName" HeaderText="类型" />--%>
                        <%-- <asp:BoundField DataField="ReferrerName" HeaderText="邀请人" HeaderStyle-Width="15%"/>--%>
                        <%-- <asp:BoundField DataField="CreateTime" HeaderText="注册时间" />    --%>
                        <asp:BoundField DataField="LastLogin" HeaderText="最后登录时间" />
                        <%-- <asp:BoundField DataField="LoginCount" HeaderText="登录次数" />--%>

                        <asp:TemplateField HeaderText="修改邀请人">
                            <ItemTemplate>
                                <a style="cursor: pointer" onclick="ShowModald('<%#"UserReferrer.aspx?UserID="+Eval("UserID")%>')">修改邀请人</a>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="购买记录">
                            <ItemTemplate>
                                <a onclick="ShowModal('<%#"User/UserBuy.aspx?UserID="+Eval("UserID")%>','课程购买记录')">购买记录</a>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="赠送记录">
                            <ItemTemplate>
                                <a onclick="ShowModal('<%#"User/UserDonate.aspx?UserID="+Eval("UserID")%>','课程赠送记录')">赠送记录</a>
                            </ItemTemplate>
                        </asp:TemplateField>


                        <asp:TemplateField HeaderText="下级用户">
                            <ItemTemplate>
                                <a onclick="ShowModal('<%#"User/UserLower.aspx?UserID="+Eval("UserID")%>','下级用户')">下级用户</a>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <%-- <asp:TemplateField HeaderText="收到赠送">
                            <ItemTemplate>                      
                    <a onclick="ShowModal('<%#"User/UserReceive.aspx?UserID="+Eval("UserID")%>','收到赠送')" >收到赠送</a> 
                            </ItemTemplate>
                    </asp:TemplateField>--%>


                        <%-- <asp:TemplateField HeaderText="收藏记录">
                            <ItemTemplate>                      
                    <a onclick="ShowModal('<%#"User/UserCollect.aspx?UserID="+Eval("UserID")%>','课程收藏记录')" >收藏记录</a> 
                            </ItemTemplate>
                        </asp:TemplateField>--%>

                        <asp:TemplateField HeaderText="状态">
                            <ItemTemplate>
                                <%#Eval("Status").ToString() == "1" ? "正常" : "禁用"%>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <asp:LinkButton runat="server" ID="LinkButton1" CommandName="Delete" OnClientClick="return confirm('确定更新状态吗？')" CausesValidation="False"><%#Eval("Status").ToString() == "-1" ? "启用" : "禁用"%></asp:LinkButton>
                                <%-- <asp:HyperLink ID="btnEdit" runat="server" NavigateUrl='<%# "UserEdit.aspx?UserID="+Eval("UserID")%>'>编辑</asp:HyperLink>&nbsp;&nbsp;--%>
                                <%-- <asp:HyperLink ID="btnDel" runat="server" NavigateUrl='<%# "UserList.aspx?="+Eval("UserID")%>'>删除</asp:HyperLink>&nbsp;&nbsp;--%>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            <div class="pagerLayout">
                <webdiyer:AspNetPager ID="netPager" CssClass="pagerLayout" runat="server" FirstPageText="首页" LastPageText="尾页"
                    NextPageText="下一页" OnPageChanged="netPager_PageChanged" PrevPageText="上一页"
                    PageSize="15">
                </webdiyer:AspNetPager>
            </div>
        </div>
    </form>
</body>
</html>

<script>
    //弹出框
    function ShowModald(pageLink) {
        layer.open({
            type: 2,
            title: '修改邀请人',
            content: pageLink,
            // area: ['40%', '80%'], 
            area: ['500px', '580px'],
            offset: '5%',
            closeBtn: 2,
            shade: [0.3, 'black'], //默认是0.3透明度的黑色背景（'#000'）如果你不想显示遮罩，可以shade: 0
            shadeClose: true,
            shift: 2, //动画，默认0，  0-6

            //end:layer 关闭刷新父页面
            end: function () {     //end - 层销毁后触发的回调。无论是确认还是取消，只要层被销毁了，end都会执行，不携带任何参数
                location.reload();
            }
        });
    }

    //弹出框
    function ShowModal(pageLink, title) {
        parent.ShowModal(pageLink, title);
    }

    ////弹出框
    //function ShowModald(pageLink, title) {
    //    parent.ShowModald(pageLink, title);

    //}

</script>
